package njClass.Control
{
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	
	import mx.core.UIComponent;
	
	public class DrawMovingRect extends EventDispatcher
	{	
		
		public var root:UIComponent;
		private var point0:Point;
		
		public function DrawMovingRect(_root:UIComponent){
			super();
			this.root=_root;
			
			root.addEventListener(MouseEvent.MOUSE_DOWN,StartDrawCube);
		}
		
		public function getRectData():void{
			
		}
		
		private function StartDrawCube(evt:MouseEvent):void{
			point0=new Point(root.mouseX,root.mouseY);
			root.addEventListener(MouseEvent.MOUSE_MOVE,MoveCube);
			root.addEventListener(MouseEvent.MOUSE_UP,CreateCube);
		}
		
		private function MoveCube(evt:MouseEvent):void{
			point0=new Point(root.mouseX,root.mouseY);
		}
		
		private function CreateCube(evt:MouseEvent):void{
			point0=new Point(root.mouseX,root.mouseY);
			root.removeEventListener(MouseEvent.MOUSE_MOVE,MoveCube);
			root.removeEventListener(MouseEvent.MOUSE_UP,CreateCube);
		}
	}
}